import React from 'react'
import { StyleSheet, Text, View, Image } from 'react-native'
import { px2dp } from 'rn-xiaobu-utils'
import PropTypes from 'prop-types'
import fontsize from '../../../configs/fontsize'
import flexStyle from '../../../configs/flex'

export default class Error extends React.Component {
  static propTypes = {
    imageUrl: PropTypes.string,
    imageStyle: PropTypes.object,
    tipsText: PropTypes.string,
    defaultText: PropTypes.object
  }
  render () {
    return (
      <View style={[flexStyle.flexV, flexStyle.flexVc]}>
        <Image source={this.props.imageUrl ? this.props.imageUrl : require('./assets/error.png')} style={this.props.object ? this.props.object : styles.defaultImg}></Image>
        <Text style={this.props.textStyle ? this.props.textStyle : [fontsize.fontsize34, styles.defaultText]}>{this.props.tipsText}</Text>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  defaultImg: {
    width: px2dp(480),
    height: px2dp(295),
    marginTop: px2dp(110)
  },
  defaultText: {
    color: '#C4CDCE',
    marginTop: px2dp(58)
  }
})